//define port 10 is Gled
//define port 11 is Rled
int Gled = 10;
int Rled = 11;

void setup() {
 //initialive INPUT and OUTPUT
  pinMode(A0, INPUT);
  pinMode(Gled, OUTPUT);
  pinMode(Rled, OUTPUT);
  Serial.begin(9600);
}

int num = 0;

void loop() {
  //receipt signal
  int sw = digitalRead(A0);
  if(sw == 0)
  {
    digitalWrite(Gled, HIGH);
    digitalWrite(Rled, HIGH);
  }
  else if(sw == 1)
  {
      digitalWrite(Gled, LOW);
      digitalWrite(Rled, LOW);
      num = num + 1;
   }
  
//output the value of num
  Serial.println(num);
  delay(1000);
}
